package 抽象类;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: GaoBo
 * Date: 2021-05-18
 * Time: 19:40
 */
abstract class Shape {
    //抽象方法：如果一个方法，没有具体的实现，那么就可以用abstract来修饰。
    public  abstract  void draw();

   /* public void func() {
        System.out.println("Fsafsa");
    }
*/
}
//alt + 回车   受查异常
class Rect extends Shape {
    @Override
    public void draw() {
        //super.func();
        System.out.println("♦");
    }

   /* public void func() {
        System.out.println("fdsasafa");
    }*/

}
class Cycle extends Shape {
    @Override
    public void draw() {
        System.out.println("●");
    }
}
/*abstract class Rect extends Shape {

    public abstract void func();
}

class A extends Rect {

    @Override
    public void draw() {

    }

    @Override
    public void func() {

    }
}*/

public class Test {

    public static void drawMap(Shape shape) {
        shape.draw();
    }
    public static void main(String[] args) {
        //Shape shape = new Shape();
        Rect rect = new Rect();
        Cycle cycle = new Cycle();
        drawMap(rect);
        drawMap(cycle);
        System.out.println("============");

        //没有发生多态
        Shape shape = new Rect();
        //shape.func();

    }
}
